import {reactive, ref, watch} from 'vue'
import { defineStore } from 'pinia'
import locStr from '@/utils/locStr.js'


export const useIndexStore = defineStore('index', () => {
  const store = reactive(
      JSON.parse(locStr.localStorage.getItem('indexParams')) || {}
  )

  watch(() => store, () => {
    locStr.localStorage.setItem('indexParams', JSON.stringify(store))
  }, {deep: true})

  return {store}
});
